package com.ruoyi.common.code;

/**
 * 全局系统错误码枚举
 * 0-999 系统异常编码保留
 *
 * 一般情况下，使用 HTTP 响应状态码 https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Status
 * 虽然说，HTTP 响应状态码作为业务使用表达能力偏弱，但是使用在系统层面还是非常不错的
 */
public interface SystemHttpCode {

    ErrorCode SUCCESS = new ErrorCode(200, "成功");
    ErrorCode CREATED = new ErrorCode(201, "对象创建成功");
    ErrorCode ACCEPTED = new ErrorCode(202, "请求已经被接受");
    ErrorCode NO_CONTENT = new ErrorCode(204, "操作已经执行成功，但是没有返回数据");
    ErrorCode MOVED_PERM = new ErrorCode(301, "资源已被移除");
    ErrorCode SEE_OTHER = new ErrorCode(303, "重定向");
    ErrorCode NOT_MODIFIED = new ErrorCode(304, "资源没有被修改");

    // ========== 客户端错误段 ==========
    ErrorCode BAD_REQUEST = new ErrorCode(400, "请求参数不正确");
    ErrorCode UNAUTHORIZED = new ErrorCode(401, "账号未登录（未授权）");
    ErrorCode FORBIDDEN = new ErrorCode(403, "访问受限，授权过期");
    ErrorCode NOT_FOUND = new ErrorCode(404, "请求未找到");
    ErrorCode METHOD_NOT_ALLOWED = new ErrorCode(405, "不允许的http方法");
    ErrorCode CONFLICT = new ErrorCode(409, "资源冲突，或者资源被锁");
    ErrorCode UNSUPPORTED_TYPE = new ErrorCode(415, "不支持的数据，媒体类型");
    ErrorCode LOCKED = new ErrorCode(423, "请求失败，请稍后重试"); // 并发请求，不允许
    ErrorCode TOO_MANY_REQUESTS = new ErrorCode(429, "请求过于频繁，请稍后重试");

    // ========== 服务端错误段 ==========
    ErrorCode INTERNAL_SERVER_ERROR = new ErrorCode(500, "系统内部错误");
    ErrorCode NOT_IMPLEMENTED = new ErrorCode(501, "功能未实现/未开启");
    ErrorCode WARN = new ErrorCode(601, "系统警告消息");
    ErrorCode ERROR_ILLEGAL = new ErrorCode(610, "非法的请求");

    // ========== 自定义错误段 ==========
    ErrorCode REPEATED_REQUESTS = new ErrorCode(900, "重复请求，请稍后重试"); // 重复请求
    ErrorCode DEMO_DENY = new ErrorCode(901, "演示模式，禁止写操作");
    ErrorCode UNKNOWN = new ErrorCode(999, "未知错误");

}
